-- co = coroutine.create(function ()
--     print("hi")
-- end)
co = coroutine.create(function ()
    for i =1,10 do
        print("co",i)
        coroutine.yield() -- 挂起
    end
end)
print(type(co))
print(coroutine.status(co))
-- coroutine.resume(co) --运行
print(coroutine.status(co))
-- coroutine.resume(co)
for i=1,10 do
    coroutine.resume(co)
end
coroutine.resume(co)
print(coroutine.status(co))
co2 = coroutine.create(function(a,b,c)
    print("co",a + b + c)
end)
coroutine.resume(co2,1,2,3)
co3 = coroutine.create(function(a,b)
    coroutine.yield(a+b,a-b)
end)
print(coroutine.resume(co3,20,10))
print(coroutine.resume(co3,20,10))
print(coroutine.resume(co3,20,10))